/**
 * @author Gavin Koh
 * created 18 Aug 2011
 * This script converts all the child terms for the periplasmic GO IDs to a global JavaScript object.
 */

//GO JSON downloaded 12 Aug 2011

(function() {
	/*
	isPeriplasm = {};
	var goRegex = /GO:\d{7}/g; //GO id's all start with 'GO:' followed by 7 digits.

	//Periplasmic space GO:0042597 (synonym GO:0005620)
	var locPeriplasmJsonString = '{"id":"GO:0042597","name":"periplasmic space","children":[{"id":"GO:0055040","name":"periplasmic flagellum"},{"id":"GO:0030288","name":"outer membrane-bounded periplasmic space","children":[{"id":"GO:0031236","name":"extrinsic to external side of plasma membrane, in periplasmic space"},{"id":"GO:0031237","name":"intrinsic to external side of plasma membrane, in periplasmic space"}]},{"id":"GO:0030287","name":"cell wall-bounded periplasmic space"}]}';
	var locPeriplasmGoArray = locPeriplasmJsonString.match(goRegex);
	for (i=0; i < locPeriplasmGoArray.length; i+=1) {
		isPeriplasm[ locPeriplasmGoArray[i] ] = true;
		//Create each GO ID as a property of the isPlasmaMembrane object.
		//We only need to test for existence.
		//There should be no repeat GO IDs, because JavaScript will simply reassign true
		//to any properties that are already there.
	};
	isPeriplasm[ 'GO:0005620' ] = true; //Additional synonym
	isPeriplasmString = JSON.stringify(isPeriplasm);
	//creates a global object so we can save space by hard-coding a smaller JavaScript object
	*/
	isPeriplasm = {"GO:0042597":true,"GO:0055040":true,"GO:0030288":true,"GO:0031236":true,"GO:0031237":true,"GO:0030287":true,"GO:0005620":true};
})();
